#include "unit.h"

using namespace std;

uint32 Unit::creature_type() const { return r1(r8(ptr() + 0x580) + 0x78); }

bool Unit::combating() const { return role_.combating(); }

bool Unit::lootable() const { return r1(ptr() + 0xCC) == 4; }

float Unit::x() const { return role_.x(); }

float Unit::y() const { return role_.y(); }

float Unit::z() const { return role_.z(); }

float Unit::h() const { return role_.h(); }

float Unit::v() const { return role_.v(); }

uint32 Unit::hp() const { return role_.hp(); }

uint32 Unit::hp_max() const { return role_.hp_max(); }

uint32 Unit::mp() const { return role_.mp(); }

uint32 Unit::mp_max() const { return role_.mp_max(); }

uint32 Unit::level() const { return role_.level(); }

uint32 Unit::casting() const { return role_.casting(); }

uint32 Unit::channel() const { return role_.channel(); }

string Unit::name() const { return (char *)r8(r8(ptr() + 0x580) + 0x170); }

uintptr Unit::ptr() const { return obj_.ptr(); }

ObjType Unit::type() const { return obj_.type(); }

uint32 Unit::index() const { return obj_.index(); }

uint64 Unit::tid1() const { return role_.tid1(); }

uint64 Unit::tid2() const { return role_.tid2(); }

uint64 Unit::id1() const { return obj_.id1(); }

uint64 Unit::id2() const { return obj_.id2(); }

Role Unit::role() const { return role_; }
Unit::Unit(uint64 ptr) : obj_{ptr}, role_{ptr} {}

Unit::~Unit() {}
